package com.synjones.zeuscloudapp.util;

import com.synjones.core.util.StringUtil;
import com.synjones.zeuscloudapp.bean.CodeDescPair;

/**
 * message枚举类
 *
 * @author jiayinhua
 * @version 1.0
 * @date 2017-07-07
 */
public enum StatusEnum {

    SUCCESS("0", "获取成功"),
    LOGIN_ERROR("1001", "账号或密码错误"),
    CHECK_ACCOUNT_ERROR("1002", "账号验证错误"),
    CHECK_PWD_ERROR("1003", "密码验证错误"),
    PAY_TRANAMT_ERROR("1004","支付金额为空"),
    PAY_MEALTYPE_ERROR("1005","支付餐次为空"),
    CHECK_ORGCODE_ERROR("1006","组织代码为空"),
    PAY_NO_TERMINAL_ERROR("1007","该终端不存在"),
    CHECK_NAME_ERROR("1008", "用户为空"),
    PAY_TYPE_ERROR("1009", "支付方式为空"),
    PAY_CARDID_ERROR("1010", "物理卡号为空"),
    CHECK_MEALTYPE_ERROR("1011", "餐次类型为空"),
    CHECK_MEALSTARTTIME_ERROR("1012", "开餐时间为空"),
    CHECK_MEALSTOPTIME_ERROR("1013", "闭餐时间为空"),
    CHECK_IMEL_ERROR("1014","imel为空"),
    CHECK_PHOTOIO_ERROR("1015","照片流为空"),
    CHECK_PHOTOTYPE_ERROR("1016","照片类型为空"),
    CHECK_SNO_ERROR("1017","SNO为空"),
    CHECK_SCORE_ERROR("1018","识别分数为空"),
    CHECH_MEALMODE_ERROR("1019", "就餐模式为空"),
    CHECH_PERSONNUMBER_ERROR("1020", "带餐人数为空"),
    CHECH_TYPE_ERROR("1021", "带餐人数为空"),
    CHECH_TERMINALTYPE_ERROR("1022", "设备类型为空"),
    AUTHOR_ERROR("2001", "权限不足"),
    BALANCE_ERROR("2002", "余额不足"),



    BUSSINESS_SELECT_NULL("2003", "查无数据"),

    CHECK_USERNAME_ERROR("2004", "用户名为空"),
    CHECK_PASSWORD_ERROR("2005", "密码为空"),

    SEND_MESSAGE_ERROR("3001", "发送短信失败"),
    SEND_MESSAGE_SUCCESS("3002", "发送成功"),
    RANDOM_REPEAT("4001", "操作频繁，请稍后再试"),
    VERIFYCODE_ERROR("5001", "验证码错误"),
    VERIFYCODE_NULL("5002", "请先获取验证码"),
    UNOPEN_ERROR("6001", "暂未开通"),
    SIGN_ERROR("9001", "签名错误"),
    PARAMS_ERROR("9002", "提交非法，请重新再试"),
    TIMEOUT_ERROR("9003", "连接超时，请稍后再试"),
    SYSTEM_ERROR("9999", "系统故障");

    private String message;
    private String statusCode;

    private StatusEnum(String statusCode, String message) {
        this.statusCode = statusCode;
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

    public String getStatusCode() {
        return statusCode;
    }
    
    /**
	 * 根据当前code与指定的desc生成CodeDescPair
	 * 
	 * @param desc
	 * @return
	 */
	public CodeDescPair genRetInfo(String desc) {
		CodeDescPair cdp = null;
		if (StringUtil.isNullOrEmpty(desc)){
            cdp = genRetInfo();
        }
		else{
            cdp = new CodeDescPair(statusCode, desc);
        }
		return cdp;
	}

	/**
	 * 根据当前的code、desc生成CodeDescPair
	 * 
	 * @return
	 */
	public CodeDescPair genRetInfo() {
		return new CodeDescPair(statusCode, message);
	}
}
